﻿using Microsoft.AspNetCore.Builder;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Star.Common.Seed
{
    public static class  SeedDataMiddleware
    {
        public static void UseSeedDataMiddle(this IApplicationBuilder app, MyContext myContext, string webRootPath)
        {
            if (app == null) throw new ArgumentNullException(nameof(app));

            try
            {
               
                    DBSeed.SeedAsync(myContext, webRootPath).Wait();
                
            }
            catch (Exception e)
            {
                throw;
            }
        }
    }
}
